﻿using Microsoft.AspNetCore.Mvc;
using MyConsume.AL;
using ZhCun.WebCommon;
using ZhCun.WebCommon.AL;
using ZhCun.WebCommon.WebPage;

namespace MyConsume.Web.Controllers
{
    public class UserController : PageUserBaseController<ALUser>
    {        
        /// <summary>
        /// 登陆页面
        /// </summary>
        [NonLoginVerify]
        public IActionResult Login()
        {
            return View();
        }
        /// <summary>
        /// 安全退出，清除token
        /// </summary>
        [NonRoleVerify]
        public IActionResult LoginOut()
        {
            LoginStateCache.Remove(LoginToken.LoginToken);
            ALObj.LoginOut();
            return RedirectToAction("Login");
        }
        /// <summary>
        /// 用户信息修改
        /// </summary>
        public IActionResult Info()
        {
            ViewBag.SaveUrl = "/api/apiuser/infosave";
            ViewBag.UserName = LoginToken.UserName;
            ViewBag.MobileNumber = LoginToken.MobileNumber;
            return View();
        }
        [NonRoleVerify]
        public IActionResult Pwd()
        {
            ViewBag.SaveUrl = "/api/apiuser/pwdsave";
            return View();
        }
    }
}